/*******************************************************************************
* File Name: PID_regulator.h
* Version 1.00
*
* Description:
*  This file provides the source code to the API for the Sequencing Successive
*  Approximation ADC Component Component.
*
* Note:
*
********************************************************************************
* Copyright 2010-2019, CMS Semiconductor Corporation.  All rights reserved.
* You may use this file only in accordance with the license, terms, conditions,
* disclaimers, and limitations in the end user license agreement accompanying
* the software package with which this file was provided.
*******************************************************************************/

#ifndef __PID_REGULATOR_H__
#define __PID_REGULATOR_H__

#ifdef __cplusplus
extern "C"
{
#endif

/*****************************************************************************/
/* Include files */
/*****************************************************************************/
#include<stdint.h>

/*****************************************************************************/
/* Global pre-processor symbols/macros ('#define') */
/*****************************************************************************/

						
/*****************************************************************************/
/* Global type definitions ('typedef') */
/*****************************************************************************/

typedef struct {
	int32_t kp;
	int32_t ki;
	int32_t kd;
	int32_t e0;
	int32_t e1;
	int32_t e2;
	int32_t du0;
	int32_t du1;
	int32_t out_pre;
	int32_t out_max;
	int32_t out_min;
} stc_pid_t;

/*****************************************************************************/
/* Global variable declarations ('extern', definition in C source) */
/*****************************************************************************/


/*****************************************************************************/
/* Global function prototypes ('extern', definition in C source) */
/*****************************************************************************/
extern void Current_PI_P0(int32_t Ref, int32_t Input,  int32_t *Output, stc_pid_t *PID_Par);

extern void Current_PI_N4(int32_t Ref, int32_t Input,  int32_t *Output, stc_pid_t *PID_Par);

extern void Current_PID_P0(int32_t Ref, int32_t Input,  int32_t *Output, stc_pid_t *PID_Par);

extern void Current_PID_N4(int32_t Ref, int32_t Input,  int32_t *Output, stc_pid_t *PID_Par);

extern void Speed_PID_P0(int32_t Ref, int32_t Input,  int32_t *Output, stc_pid_t *PID_Par);

extern void Speed_PID_P4(int32_t Ref, int32_t Input,  int32_t *Output, stc_pid_t *PID_Par);


#ifdef __cplusplus
}
#endif

#endif /* __PID_REGULATOR_H__ */

